package com.stations.controller;

import com.stations.common.constant.ControllerConstant;
import com.stations.common.web.base.BaseController;
import com.stations.common.web.domain.response.Result;
import com.stations.domain.TTransmitter;
import com.stations.domain.dtree.DTree;
import com.stations.domain.dtree.DTreeResponse;
import com.stations.domain.dtree.Status;
import com.stations.service.TrasmiterService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * Describe: 发射机控制器
 * Author: Ljy
 * CreateTime: 2019/10/23
 */
@RestController
@Api(tags = {"发射机管理"})
@RequestMapping(ControllerConstant.API_SYSTEM_PREFIX + "view")
public class TransmiterViewController extends BaseController {

    /**
     * Describe: 发射机模块基础路径
     */
    private static String MODULE_TRANSMITTER_PATH = "system/transmitter/";

    /**
     * Describe: 发射机参数设置模块基础路径
     */
    private static String MODULE_TRANSMITTER_SETTING_PATH = "system/transmitter/param/";

    /**
     * Describe: 发射机任务基础路径
     */
    private static String MODULE_TRANSMITTER_PROGRAM_PATH = "system/program/";
    /**
     * Describe: 发射机任务基础路径
     */
    private static String MODULE_TRANSMITTER_TASK_PATH = "system/transmittertask/";

    /**
     * Describe: 发射机日志基础路径
     */
    private static String MODULE_TRANSMITTER_LOG_PATH = "system/transmitterlog/";

    /**
     * Describe: 发射机告警基础路径
     */
    private static String MODULE_TRANSMITTER_EXCEPTION_PATH = "system/transmitterexception/";

    /**
     * Describe: 台站管理基础路径
     */
    private static String MODULE_STATION_PATH = "system/station/";


//发射机模块基础路径
    /**
     * Describe: 发射机状态列表视图
     * Param ModelAndView
     * Return 发射机状态列表视图
     */
    @GetMapping("transmitter_dynamics")
    @ApiOperation(value = "发射机状态列表视图")
    @PreAuthorize("hasPermission('/system/transmitter/transmitter_dynamics','sys:transmitter:transmitter_dynamics')")
    public ModelAndView transmitter_dynamics() {
        return jumpPage(MODULE_TRANSMITTER_PATH + "transmitter_dynamics");
    }


    /**
     * Describe: 获取发射机列表视图
     * Param ModelAndView
     * Return 发射机视图
     */
    @GetMapping("transmitter_manage")
    @ApiOperation(value = "获取发射机列表视图")
    @PreAuthorize("hasPermission('/system/transmitter/transmitter_manage','sys:transmitter:transmitter_manage')")
    public ModelAndView transmitter_manage() {
        return jumpPage(MODULE_TRANSMITTER_PATH + "transmitter_manage");
    }



    /**
     * Describe: 发射机添加视图
     * Param ModelAndView
     * Return 发射机添加视图
     */
    @GetMapping("transmitter_add")
    @ApiOperation(value = "发射机添加视图")
    @PreAuthorize("hasPermission('/system/transmitter/transmitter_add','sys:transmitter:transmitter_add')")
    public ModelAndView transmitter_add() {
        return jumpPage(MODULE_TRANSMITTER_PATH + "transmitter_add");
    }

    /**
     * Describe: 发射机编辑视图
     * Param ModelAndView
     * Return 发射机编辑视图
     */
    @GetMapping("getTransmitterEdit")
    @ApiOperation(value = "发射机编辑视图")
    @PreAuthorize("hasPermission('/system/transmitter/getTransmitterEdit','sys:transmitter:getTransmitterEdit')")
    public ModelAndView getTransmitterEdit() {
        return jumpPage(MODULE_TRANSMITTER_PATH + "transmitter_edit");
    }


    /**
     * Describe: 发射机运行参数视图
     * Param ModelAndView
     * Return 发射机运行参数视图
     */
    @GetMapping("getTransmitterRunningStatus")
    @ApiOperation(value = "发射机编辑视图")
    @PreAuthorize("hasPermission('/system/transmitter/getTransmitterRunningStatus','sys:transmitter:getTransmitterRunningStatus')")
    public ModelAndView getTransmitterRunningStatus() {
        return jumpPage(MODULE_TRANSMITTER_PATH + "transmitter_runningstatus");
    }

//发射机参数设置模块基础路径

    /**
     * Describe: 发射机参数设置主视图
     * Param ModelAndView
     * Return 发射机参数设置主视图
     */
    @GetMapping("setting")
    @ApiOperation(value = "发射机参数设置主视图")
    @PreAuthorize("hasPermission('/system/transmitter/setting','sys:transmitter:setting')")
    public ModelAndView setting() {
        return jumpPage(MODULE_TRANSMITTER_SETTING_PATH+ "setting");
    }


    /**
     * Describe: 发射机通讯参数设置视图
     * Param ModelAndView
     * Return 发射机通讯参数设置视图
     */
    @GetMapping("communication")
    @ApiOperation(value = "发射机通讯参数设置视图")
    @PreAuthorize("hasPermission('/system/transmitter/communication','sys:transmitter:communication')")
    public ModelAndView communication() {
        return jumpPage(MODULE_TRANSMITTER_SETTING_PATH+ "communication");
    }

    /**
     * Describe: 发射机参数设置主视图
     * Param ModelAndView
     * Return 发射机参数设置主视图
     */
    @GetMapping("playTask")
    @ApiOperation(value = "发射机参数设置主视图")
    @PreAuthorize("hasPermission('/system/transmitter/playTask','sys:transmitter:playTask')")
    public ModelAndView playTask() {
        return jumpPage(MODULE_TRANSMITTER_SETTING_PATH+ "playTask");
    }

    /**
     * Describe: 发射机参数设置主视图
     * Param ModelAndView
     * Return 发射机参数设置主视图
     */
    @GetMapping("setstatus")
    @ApiOperation(value = "运行参数设置")
    @PreAuthorize("hasPermission('/system/transmitter/setstatus','sys:transmitter:setstatus')")
    public ModelAndView setstatus() {
        return jumpPage(MODULE_TRANSMITTER_SETTING_PATH+ "setstatus");
    }

    /**
     * Describe: 发射机参数设置主视图
     * Param ModelAndView
     * Return 发射机参数设置主视图
     */
    @GetMapping("setfunction")
    @ApiOperation(value = "功能参数设置")
    @PreAuthorize("hasPermission('/system/transmitter/setfunction','sys:transmitter:setfunction')")
    public ModelAndView setfunction() {
        return jumpPage(MODULE_TRANSMITTER_SETTING_PATH+ "setfunction");
    }

    /**
     * Describe: 发射机时钟校准视图
     * Param ModelAndView
     * Return 发射机时钟校准视图
     */
    @GetMapping("clock")
    @ApiOperation(value = "发射机时钟校准视图")
    @PreAuthorize("hasPermission('/system/transmitter/clock','sys:transmitter:clock')")
    public ModelAndView clock() {
        return jumpPage(MODULE_TRANSMITTER_SETTING_PATH+ "clock");
    }

//发射机任务基础路径
    @GetMapping("task_manage")
    @ApiOperation(value = "获取发射机任务列表视图")
    @PreAuthorize("hasPermission('/system/transmittertask/program_manage','sys:transmittertask:program_manage')")
    public ModelAndView task_manage() {
        return jumpPage(MODULE_TRANSMITTER_TASK_PATH + "task_manage");
    }

    /**
     * Describe: 发射机节目详情试图
     * Param ModelAndView
     * Return 发射机节目详情试图
     */
    @GetMapping("getTaskDetail")
    @ApiOperation(value = "发射机节目详情试图")
    @PreAuthorize("hasPermission('/system/transmittertask/getTaskDetail','sys:transmittertask:getTaskDetail')")
    public ModelAndView getTaskDetail() {
        return jumpPage(MODULE_TRANSMITTER_TASK_PATH + "task_detail");
    }

    @GetMapping("program_manage")
    @ApiOperation(value = "获取发射机任务列表视图")
    @PreAuthorize("hasPermission('/system/transmitterprogram/program_manage','sys:transmitterprogram:program_manage')")
    public ModelAndView program_manage() {
        return jumpPage(MODULE_TRANSMITTER_PROGRAM_PATH + "program_manage");
    }

    /**
     * Describe: 发射机节目添加视图
     * Param ModelAndView
     * Return 发射机节目添加视图
     */
    @GetMapping("program_add")
    @ApiOperation(value = "获取台站添加视图")
    @PreAuthorize("hasPermission('/system/transmitterprogram/program_add','sys:transmitterprogram:program_add')")
    public ModelAndView program_add() {
        return jumpPage(MODULE_TRANSMITTER_PROGRAM_PATH + "program_add");
    }

    /**
     * Describe: 发射机节目详情试图
     * Param ModelAndView
     * Return 发射机节目详情试图
     */
    @GetMapping("getProgramDetail")
    @ApiOperation(value = "发射机节目详情试图")
    @PreAuthorize("hasPermission('/system/transmitterprogram/getProgramDetail','sys:transmitterprogram:getProgramDetail')")
    public ModelAndView getProgramDetail() {
        return jumpPage(MODULE_TRANSMITTER_PROGRAM_PATH + "program_detail");
    }


    /**
     * Describe: 发射机节目编辑试图
     * Param ModelAndView
     * Return 发射机节目编辑试图
     */
    @GetMapping("getProgramEdit")
    @ApiOperation(value = "发射机节目编辑试图")
    @PreAuthorize("hasPermission('/system/transmitterprogram/getProgramEdit','sys:transmitterprogram:getProgramEdit')")
    public ModelAndView getProgramEdit() {
        return jumpPage(MODULE_TRANSMITTER_PROGRAM_PATH + "program_edit");
    }


//发射机日志基础路径
    /**
     * Describe: 获取发射机日志列表视图
     * Param ModelAndView
     * Return 获取发射机日志列表视图
     */
    @GetMapping("log")
    @ApiOperation(value = "获取发射机日志列表视图")
    @PreAuthorize("hasPermission('/system/transmitterlog/log','sys:transmitterlog:log')")
    public ModelAndView log() {
        return jumpPage(MODULE_TRANSMITTER_LOG_PATH + "transmitterlog");
    }

    /**
     * Describe: 获取发射机告警列表视图
     * Param ModelAndView
     * Return 发射机告警视图
     */
    @GetMapping("exception")
    @ApiOperation(value = "获取发射机告警列表视图")
    @PreAuthorize("hasPermission('/system/transmitterexception/exception','sys:transmitterexception:exception')")
    public ModelAndView exception() {
        return jumpPage(MODULE_TRANSMITTER_EXCEPTION_PATH + "transmitterexception");
    }

//台站管理基础路径
    /**
     * Describe: 获取台站列表视图
     * Param ModelAndView
     * Return 台站视图
     */
    @GetMapping("station_manage")
    @ApiOperation(value = "获取台站列表视图")
    @PreAuthorize("hasPermission('/system/station/station_manage','sys:station:station_manage')")
    public ModelAndView station_manage() {
        return jumpPage(MODULE_STATION_PATH + "station_manage");
    }


    /**
     * Describe: 获取台站添加视图
     * Param ModelAndView
     * Return 台站添加页面
     */
    @GetMapping("station_add")
    @ApiOperation(value = "获取台站添加视图")
    @PreAuthorize("hasPermission('/system/station/station_add','sys:station:station_add')")
    public ModelAndView station_add() {
        return jumpPage(MODULE_STATION_PATH + "station_add");
    }


    /**
     * Describe: 获取台站编辑视图
     * Param ModelAndView
     * Return 台站视图
     */
    @GetMapping("station_edit")
    @ApiOperation(value = "获取台站编辑视图")
    @PreAuthorize("hasPermission('/system/station/station_edit','sys:station:station_edit')")
    public ModelAndView station_edit() {
        return jumpPage(MODULE_STATION_PATH + "station_edit");
    }


}
